package com.lxq.LeetCode.firstUniqChar;

import java.util.Arrays;
import java.util.HashSet;

public class Solution {
    public static void main(String[] args) {
        String s = "";
        int res = firstUniqChar(s);
        System.out.println(res);
    }

    public static int firstUniqChar(String s) {
        int[] alphabeta = new int[26];
        for (int i = 0; i < s.length(); i++) {
            int tag = s.charAt(i) - 'a';
            alphabeta[tag]++;
        }
        for (int i = 0; i < s.length(); i++) {
            int tag = s.charAt(i) - 'a';
            if (alphabeta[tag] == 1){
                return i;
            }
        }
        return -1;
    }
}
